package com.sense.kukoo.biz_explore.adapter

import com.sense.kukoo.biz_explore.adapter.provider.EditorPicks1ItemProvider
import com.sense.kukoo.biz_explore.adapter.provider.EditorPicks2ItemProvider
import com.sense.kukoo.biz_explore.adapter.provider.RecommendedItemProvider
import com.sense.kukoo.common.repo.bean.BookBean
import com.sense.kukoo.common.repo.bean.ExploreContentBean
import com.sense.kukoo.common.wiget.adapter.MultiItemAdapter

class ExploreContentAdapter(
    data: MutableList<ExploreContentBean>,
    val mListener: ExploreContentEventListener
) :
    MultiItemAdapter<ExploreContentBean>(data) {

    init {
        addItemProvider(EditorPicks1ItemProvider(mListener))
        addItemProvider(EditorPicks2ItemProvider(mListener))
        addItemProvider(RecommendedItemProvider(mListener))
    }

    override fun getItemType(data: MutableList<ExploreContentBean>, position: Int): Int {
        return data.get(position).itemType()
    }

    interface ExploreContentEventListener {
        fun onClickSeeAll(bean: ExploreContentBean, code: String)
        fun onClickBook(bean: ExploreContentBean, book: BookBean)
        fun onClickBookPlay(bean: ExploreContentBean, book: BookBean)
    }
}